//package nancal.mp.mvc.devops
//
//import com.alibaba.cloud.nacos.NacosDiscoveryProperties
//import org.springframework.web.bind.annotation.PostMapping

//import org.springframework.web.bind.annotation.RequestMapping

//import org.springframework.web.bind.annotation.*

//import com.alibaba.nacos.api.NacosFactory
//import com.alibaba.nacos.api.config.ConfigService
//import com.alibaba.nacos.api.config.listener.Listener
//

//import nbcp.base.utils.*
//import java.util.*
//import java.util.concurrent.Executor
//
//
//@RequestMapping("/dev/nacos")
//@RestController
//class NacosController {
//
//    @PostMapping("/get")
//    fun getConfig(ns: String, dataId: String): ApiResult<String> {
//        //https://nacos.io/zh-cn/docs/sdk.html
//        var group = "DEFAULT_GROUP"
//
//        var ps = Properties();
//        ps.put("serverAddr", SpringUtil.getBean<NacosDiscoveryProperties>().serverAddr)
//        ps.put("namespace", ns)
//        var configService: ConfigService = NacosFactory.createConfigService(ps);
//
//        var content = "";
//        var lock: java.lang.Object = java.lang.Object()
//        synchronized(lock) {
//            var configKey = configService.getConfigAndSignListener(dataId, group, 5000, object : Listener {
//                override fun receiveConfigInfo(configInfo: String) {
//                    content = configInfo;
//                    lock.notify()
//                }
//
//                override fun getExecutor(): Executor? {
//                    return null
//                }
//            })
//
//            lock.wait(3000);
//        }
//
//        return ApiResult.of(content)
////        // 推送config。将原有dataid中信息替换。
////        val isPublishOk = configService.publishConfig(dataId, group, "publish config content")
////
////        map["isPublishOk"] = isPublishOk
////        Thread.sleep(3000)
////        content = configService.getConfig(dataId, group, 5000)
////        println("Thread sleep 3000ms : $content")
////        map["Thread sleep 3000ms : "] = content
////        // 删除指定dataid , group 配置
////        val isRemoveOk = configService.removeConfig(dataId, group)
////        println("remove " + dataId + "config is " + isRemoveOk)
////        Thread.sleep(3000)
////        content = configService.getConfig(dataId, group, 5000)
////        println("content after 5000ms $content")
////        Thread.sleep(3000)
////        return map
//    }
//
//}